#ifndef PCVA_TEST_SUPPORT_CYCLES_H
#define PCVA_TEST_SUPPORT_CYCLES_H

/*************************************************************************
 * HEADER NAME:    test_support_cycles.h
 * PROJECT CODE:   BlueStream
 * DESCRIPTION:    Characterise performance on ARM
 * MAINTAINER:     Ivan Griffin
 * CREATION DATE:  19 Mar 2003
 *           
 * SOURCE CONTROL: $Id: test_support_cycles.h,v 1.1 2008/02/03 09:39:38 james Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2003-2004 Ceva Inc.
 *     All rights reserved.
 *
 *
 *************************************************************************/
#include "sys_config.h"                 /* First configure the build        */

#include <stdio.h>
#include <string.h>

#include "test_sys.h"
#include "test_support.h"

typedef struct
{
    u_int32 lsb;
    u_int32 msb;
} t_TESTsup_CPU_Ticks;

/* ensure we are building for ARM with at least ADS 1.2 */
#if defined(ARM_PLATFORM) && (__ARMCC_VERSION >= 120805)
#    define TESTsup_ARM_CYCLE_COUNTING_SUPPORTED (BUILD_TYPE==UNIT_TEST_BUILD)
#else
#    define TESTsup_ARM_CYCLE_COUNTING_SUPPORTED 0
#endif

#if (TESTsup_ARM_CYCLE_COUNTING_SUPPORTED==1)
    void TESTsup_Cycles_Initialise(void);
    void TESTsup_Cycles_Start_IRQ(int jal_irq_mask);
    void TESTsup_Cycles_End_IRQ(int jal_irq_mask);
    t_TESTsup_CPU_Ticks const * TESTsup_Cycles_Get_Max_For(int irq_type);
    void TESTsup_Cycles_Print_For(int jal_irq_mask);
    void TESTsup_Cycles_Shutdown(void);
    void TESTsup_Cycles_Register_Name(char const *name);
    void TESTsup_Cycles_Start_Counting(t_TESTsup_CPU_Ticks *p_my_counter);
    void TESTsup_Cycles_Stop_Counting(t_TESTsup_CPU_Ticks *p_my_counter);
    void TESTsup_Cycles_Print_Values_For(t_TESTsup_CPU_Ticks const *p_my_counter);
#else
#    define TESTsup_Cycles_Initialise()          ;
#    define TESTsup_Cycles_Start_IRQ(FOO)        ;
#    define TESTsup_Cycles_End_IRQ(FOO)          ;
#    define TESTsup_Cycles_Get_Max_For(FOO)      0
#    define TESTsup_Cycles_Print_For(FOO)        ;
#    define TESTsup_Cycles_Shutdown()            ;
#    define TESTsup_Cycles_Register_Name(FOO)    ;
#    define TESTsup_Cycles_Start_Counting(FOO)   ;
#    define TESTsup_Cycles_Stop_Counting(FOO)    ;
#    define TESTsup_Cycles_Print_Values_For(FOO) ;
#endif

#endif
